﻿<%@ Page Language="C#" MasterPageFile="~/Admin/SiteAdmin.Master" AutoEventWireup="true" CodeBehind="BaoCao.aspx.cs" Inherits="DM.Web.Admin.QuanLyBaoCaoTaiChinh.BaoCaoTaiChinhNam" Title="Công ty cổ phần Đường Man - Duong Malt JSC" %>
<%@ Import Namespace="DM.DAO" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<h1>Quản lý các file Báo cáo</h1>
<fieldset>
    <legend><b>Upload báo cáo</b></legend>
    <table width="100%" style="border:none;">
        <tr>
            <td style="width:20%;" align="right"><b>Chọn loại báo cáo</b></td>
            <td style="width:30%;">
                <asp:DropDownList ID="dlLoaiBaoCao" Width="90%" runat="server">
                    <asp:ListItem Text="Báo cáo thường niên" Value="1"></asp:ListItem>
                    <asp:ListItem Text="Báo cáo tài chính" Value="0"></asp:ListItem>
                </asp:DropDownList>
            </td>
            <td style="width:20%;" align="right"></td>
            <td style="width:30%;">                
            </td>
        </tr>
        <tr>
            <td style="width:20%" align="right"><b>Tên báo cáo</b></td>
            <td colspan="3"><asp:TextBox ID="txtTenBC" runat="server" Width="60%"></asp:TextBox><asp:RequiredFieldValidator ID="rFVTenBc" runat="server" ControlToValidate="txtTenBC" ErrorMessage="Nhập tên báo cáo!"></asp:RequiredFieldValidator></td>
        </tr>
        <tr>
            <td style="width:20%" align="right"><b>Quý</b></td>
            <td style="width:30%">
                <asp:DropDownList ID="dlQuy"  Height="20px" runat="server" Width="90%">
                    <asp:ListItem Text="Quý 1" Value="1"></asp:ListItem>
                    <asp:ListItem Text="Quý 2" Value="2"></asp:ListItem>
                    <asp:ListItem Text="Quý 3" Value="3"></asp:ListItem>
                    <asp:ListItem Text="Quý 4" Value="4"></asp:ListItem>
                </asp:DropDownList>
            </td>
            <td style="width:20%" align="right"><b>Năm</b></td>
            <td style="width:30%">
                <asp:TextBox ID="txtNam" runat="server" Width="90%"></asp:TextBox>                
            </td>
        </tr>
        <tr>
            <td style="width: 20%" align="right"><b>Upload File</b></td>
            <td style="width:30%"><asp:FileUpload ID="fuBaoCao" runat="server" Width="100%" EnableViewState="true" /></td>
            <td style="width:20%"><asp:Button ID="btnUpload" CausesValidation="false" runat="server" Width="100px" Text="Upload" OnClick="btnUpload_Click" /></td>
            <td style="width:30%"><asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtNam" ErrorMessage="Chưa nhập năm"></asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtNam" ValidationExpression="^\d{4}" ErrorMessage="Cần nhập 4 chữ số"></asp:RegularExpressionValidator></td>
        </tr>
    </table>
</fieldset>
<fieldset>
    <legend>Danh sách báo cáo</legend>
    <table width="100%" style="border:none">
        <tr>
            <td style="width:20%; height: 23px;" align="right"><b>Chọn loại báo cáo</b></td>
            <td style="width:30%; height: 23px;">
                <asp:DropDownList ID="dlLoaiBaoCao1" AutoPostBack="true" Width="90%" runat="server" OnSelectedIndexChanged="dlLoaiBaoCao1_SelectedIndexChanged">
                    <asp:ListItem Text="Báo cáo thường niên" Value="1"></asp:ListItem>
                    <asp:ListItem Text="Báo cáo tài chính" Value="0"></asp:ListItem>
                </asp:DropDownList>
            </td>
            <td style="width:20%; height: 23px;"></td>
            <td style="width:30%; height: 23px;"></td>
            <td style="height: 23px" ></td>
        </tr>
        <tr>
            <td colspan="4">
                <asp:GridView ID="gviewBaoCao" runat="server"  BackColor="White" BorderColor="#51A5B8"
                BorderStyle="Solid" BorderWidth="1px" CellPadding="4" GridLines="Horizontal" AllowPaging="True" AllowSorting="True" Width="100%" AutoGenerateColumns="False" EmptyDataText="Chưa có tin nào !" DataKeyNames="Ma" HorizontalAlign="Center" EnableViewState="true" OnPageIndexChanging="gviewBaoCao_PageIndexChanging">
                <RowStyle BackColor="GhostWhite" ForeColor="#333333" BorderColor="Gray" BorderStyle="Solid" BorderWidth="1px" />
                <FooterStyle BackColor="#51A5B8" ForeColor="#333333" HorizontalAlign="Center" VerticalAlign="Middle" />
                <PagerStyle BackColor="#51A5B8" ForeColor="WhiteSmoke" BorderColor="Gray" BorderStyle="Solid" BorderWidth="1px" Wrap="False" Font-Overline="False" Font-Size="Smaller" Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Right" />
                <SelectedRowStyle BackColor="#339966" Font-Bold="True" ForeColor="White" Wrap="True" />
                <HeaderStyle BackColor="#51A5B8" Font-Bold="True" ForeColor="White" />
                <Columns>
                    <asp:TemplateField>
                        <ItemTemplate>
                      	    <asp:Button ID="ButtonEdit" runat = "server" Text="Sửa" Width="38px" ForeColor="#0000C0" OnClick="ButtonEdit_Click" CausesValidation="false"/>
                        </ItemTemplate>
                        <EditItemTemplate>
                        </EditItemTemplate>
                        <ItemStyle BorderColor="Silver" BorderStyle="Dotted" BorderWidth="1px" Width="40px" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="T&#234;n b&#225;o c&#225;o t&#224;i ch&#237;nh">
                        <ItemTemplate>
                            <asp:Label ID= "idTenBaoCao" runat = "server" Text='<%#"Báo cáo "+((dlLoaiBaoCao1.SelectedValue=="1")?"thường niên ":"tài chính ")+(((int)Eval("Quy")!=0)?("quý "+Eval("Quy")+" "):" ") + "năm "+Eval("Nam")+" - "+Eval("TenBaoCao")%>' />
                        </ItemTemplate>
                        <EditItemTemplate>
                            Loại
                            <asp:DropDownList ID="dlEditLoai" runat="server" AutoPostBack="true">
                                <asp:ListItem Text="BCTN" Value="0"></asp:ListItem>
                                <asp:ListItem Text="BCTC" Value="1"></asp:ListItem>
                            </asp:DropDownList>
                            Năm
                            <asp:TextBox ID="txtEditNam" Width="50px" runat="server"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtEditNam" ValidationGroup="Edit"  ErrorMessage="*"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ErrorMessage="*" ControlToValidate="txtEditNam" ValidationExpression="^\d{4}" ValidationGroup="Edit"></asp:RegularExpressionValidator>
                            Quý
                            <asp:DropDownList ID="dlEditQuy" runat="server">
                                <asp:ListItem Text="Quý 1" Value="1"></asp:ListItem>
                                <asp:ListItem Text="Quý 2" Value="2"></asp:ListItem>
                                <asp:ListItem Text="Quý 3" Value="3"></asp:ListItem>
                                <asp:ListItem Text="Quý 4" Value="4"></asp:ListItem>
                            </asp:DropDownList>                            
                            Tên BC
                            <asp:TextBox ID="txtEditTenBC" runat="server" ></asp:TextBox>
                            <asp:RequiredFieldValidator ID="rFVEditTenBC" runat="server" ValidationGroup="Edit" ControlToValidate="txtEditTenBC" ErrorMessage="*"></asp:RequiredFieldValidator>
                        </EditItemTemplate>
                        <ItemStyle Wrap="True" BorderColor="Silver" BorderStyle="Dotted" BorderWidth="1px" />
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <a href='<%#"../../"+Eval("TenFile")%>'>Dowload</a>
                        </ItemTemplate>
                        <EditItemTemplate></EditItemTemplate>
                        <ItemStyle Wrap="True" BorderColor="Silver" BorderStyle="Dotted" BorderWidth="1px" />
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                      	    <asp:Button ID="ButtonXoa" runat="server" Text="Xóa" Width="38px" OnClientClick="return confirm('Bạn có chắc chắn muốn xóa không?')" ForeColor="Red" OnClick="ButtonXoa_Click"/>
                        </ItemTemplate>
                        <ItemStyle BorderColor="Silver" BorderStyle="Dotted" BorderWidth="1px" Width="80px" />
                        <EditItemTemplate>
                            <table>
                                <tr>
                                <td><asp:Button ID="ButtonSave" runat="server" ValidationGroup="Edit" CausesValidation="true" ForeColor="Red"
                                Text="Ok" Width="35px" OnClick="ButtonSave_Click" /></td>
                                <td><asp:Button ID="ButtonCancel" runat="server" CausesValidation="false" ForeColor="Blue"
                                Text="No" Width="35px" OnClick="ButtonCancel_Click" /></td>
                                </tr>
                            </table>
                        </EditItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <EmptyDataRowStyle ForeColor="Red" />
                <AlternatingRowStyle BackColor="#C0D7DD" />
                <PagerSettings Mode="NumericFirstLast" PageButtonCount="3" />
                <EditRowStyle BackColor="#404040" BorderStyle="Solid" BorderWidth="1px"
                    ForeColor="White" />
            </asp:GridView>
            </td>
        </tr>
    </table>
</fieldset>
</asp:Content>
